<?php	
include '../wp-includes/php/DBManager.class.php';

$db = new DBManager ( 'localhost',  'root',  '',  'iumus' );

if (isset ($_GET['reciver']) )
	foreach( $_GET['reciver'] as &$dest){ 
		$query="INSERT INTO iumus.messaggi (mittente, destinatario, oggetto, messaggio, letto, data_invio) 
		VALUES ( 'admin', '".$dest."', '".$_GET['object']."', '".$_GET['con']."', '1', CURRENT_TIMESTAMP);";
		$db->executeQuery ($query);
		header ("Location: index.php");
	}
else{
	$query="INSERT INTO iumus.messaggi (mittente, destinatario, oggetto, messaggio, letto, data_invio) 
		VALUES ( 'admin', '".$_POST['desinatario']."', '".$_POST['object']."', '".$_POST['con']."', '1', CURRENT_TIMESTAMP);";
		$db->executeQuery ($query);
		echo '<script type="text/javascript">window.close();</script>';
}



?>

